package Vista;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import java.awt.event.ActionListener;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JFrameCategoria extends javax.swing.JFrame {
	private JPanel jPanelCategoria;
	private JLabel jLblCodCateg;
	private JButton jBtnSalir;
	private JButton jBtnLimpiar;
	private JButton jBtnModificar;
	private JButton jBtnEliminar;
	private JButton jBtnAgregar;
	private JButton jBtnBuscar;
	private JTextField jTxtNombCateg;
	private JTextField jTxtCodCateg;
	private JLabel jLblNombCateg;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrameCategoria inst = new JFrameCategoria();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public JFrameCategoria() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			this.setTitle("-SGECR- [Modulo de Archivos] - Categorias");
			getContentPane().setBackground(new java.awt.Color(93,193,225));
			{
				jPanelCategoria = new JPanel();
				GroupLayout jPanelCategoriaLayout = new GroupLayout((JComponent)jPanelCategoria);
				jPanelCategoria.setLayout(jPanelCategoriaLayout);
				jPanelCategoria.setBackground(new java.awt.Color(173,216,230));
				{
					jLblCodCateg = new JLabel();
					jLblCodCateg.setText("Cod. Categoria:");
				}
				{
					jTxtCodCateg = new JTextField();
				}
				{
					jTxtNombCateg = new JTextField();
				}
				{
					jBtnBuscar = new JButton();
					jBtnBuscar.setText("Buscar");
				}
				{
					jBtnAgregar = new JButton();
					jBtnAgregar.setText("Agregar");
					jBtnAgregar.setFont(new java.awt.Font("Dialog",0,12));
				}
				{
					jBtnEliminar = new JButton();
					jBtnEliminar.setText("Eliminar");
				}
				{
					jBtnModificar = new JButton();
					jBtnModificar.setText("Modificar");
				}
				{
					jBtnLimpiar = new JButton();
					jBtnLimpiar.setText("Limpiar");
				}
				{
					jBtnSalir = new JButton();
					jBtnSalir.setText("Salir");
				}
				{
					jLblNombCateg = new JLabel();
					jLblNombCateg.setText("Nombre: ");
				}
				jPanelCategoriaLayout.setHorizontalGroup(jPanelCategoriaLayout.createSequentialGroup()
					.addContainerGap(24, 24)
					.addGroup(jPanelCategoriaLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelCategoriaLayout.createSequentialGroup()
					        .addComponent(jBtnAgregar, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jBtnModificar, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jBtnEliminar, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jBtnLimpiar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jBtnSalir, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelCategoriaLayout.createSequentialGroup()
					        .addGap(7)
					        .addGroup(jPanelCategoriaLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelCategoriaLayout.createSequentialGroup()
					                .addComponent(jLblNombCateg, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
					                .addGap(33))
					            .addComponent(jLblCodCateg, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE))
					        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					        .addGroup(jPanelCategoriaLayout.createParallelGroup()
					            .addComponent(jTxtCodCateg, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
					            .addComponent(jTxtNombCateg, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
					        .addGap(0, 26, Short.MAX_VALUE)
					        .addComponent(jBtnBuscar, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)
					        .addGap(61)))
					.addContainerGap(30, 30));
				jPanelCategoriaLayout.setVerticalGroup(jPanelCategoriaLayout.createSequentialGroup()
					.addContainerGap(38, 38)
					.addGroup(jPanelCategoriaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtCodCateg, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblCodCateg, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnBuscar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(jPanelCategoriaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtNombCateg, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblNombCateg, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(37)
					.addGroup(jPanelCategoriaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnAgregar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnModificar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnEliminar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnLimpiar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnSalir, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(26, 26));
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(29, 29)
				.addComponent(jPanelCategoria, GroupLayout.PREFERRED_SIZE, 170, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(44, Short.MAX_VALUE));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(31, 31)
				.addComponent(jPanelCategoria, GroupLayout.PREFERRED_SIZE, 460, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(25, Short.MAX_VALUE));
			pack();
			this.setSize(526, 273);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	

	public void addListener(ActionListener actionlistener)
	{
		jBtnBuscar.addActionListener(actionlistener);
		jBtnAgregar.addActionListener(actionlistener);
		jBtnModificar.addActionListener(actionlistener);
		jBtnEliminar.addActionListener(actionlistener);
		jBtnLimpiar.addActionListener(actionlistener);
		jBtnSalir.addActionListener(actionlistener);
	}
	
	public void MostrarMensaje(String mensaje)
	{
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public String getCodCateg()
	{
	 return jTxtCodCateg.getText();
	 
	}
	public String getNombCateg()
	{
	 return jTxtNombCateg.getText();
	 
	}
	public void setCodCateg(String cod)
	{
		jTxtCodCateg.setText(cod);
	}
	public void setNombCateg(String nomb)
	{
		jTxtNombCateg.setText(nomb);
	}
	public void Blanquear()
	{
		jTxtCodCateg.setText("");
		jTxtNombCateg.setText("");
		
	}
	
	public void Habilitar(boolean r) {
		// TODO Auto-generated method stub
		
		if(r=true)
		{
			jTxtCodCateg.setEditable(false);
			jTxtNombCateg.setEditable(true);
		}
		else jTxtCodCateg.setEditable(true);
	}
	

}
